package com.tjsinfo.tjsoa.resource.duty.bo;

import java.util.List;
import com.tjsinfo.tjsoa.Dao.IHibernateDao;
import com.tjsinfo.tjsoa.Dao.IQbcDao;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.tjsinfo.tjsoa.resource.TResourceFactory;
import com.tjsinfo.tjsoa.resource.duty.dao.ITResourceDutyDao;
import com.tjsinfo.tjsoa.resource.duty.vo.TResourceDuty;

public class TResourceDutyManagerImpl implements TResourceDutyManager {
	
	private IQbcDao qbcDao;
	private IHibernateDao hibernateDao;
	private ITResourceDutyDao resourcedutyDao;
	
	public IHibernateDao getHibernateDao() {
		return hibernateDao;
	}

	public void setHibernateDao(IHibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}

	public IQbcDao getQbcDao() {
		return qbcDao;
	}

	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}
	
	
	public ITResourceDutyDao getResourcedutyDao() {
		return resourcedutyDao;
	}

	public void setResourcedutyDao(ITResourceDutyDao resourcedutyDao) {
		this.resourcedutyDao = resourcedutyDao;
	}

	public int save(TResourceDuty transientInstance) {
		// TODO Auto-generated method stub
		return resourcedutyDao.save(transientInstance);
	}
	public void delete(TResourceDuty persistentInstance) {
		// TODO Auto-generated method stub
		resourcedutyDao.delete(persistentInstance);
//		hibernateDao.delete(systemReminded);
	}

	public boolean update(TResourceDuty transientInstance) {
		// TODO Auto-generated method stub
		//resourcedutyDao.delete(transientInstance);
		return resourcedutyDao.update(transientInstance);
	}

	public TResourceDuty findById(Integer id) {
		// TODO Auto-generated method stub
		return resourcedutyDao.findById(id);
	}
	
	public TResourceDuty findByDate(String dutyDate){
		// TODO Auto-generated method stub
		DetachedCriteria criteria = DetachedCriteria.forClass(TResourceDuty.class);
		criteria.add(Restrictions.eq("dutyDate", dutyDate));
		if (qbcDao.getCriteria(criteria).size()>0) {
			return  (TResourceDuty) qbcDao.getCriteria(criteria).iterator().next();
		}
		return  null;
	}
//	public List findBydate(String dutyDate){
//		// TODO Auto-generated method stub
//		DetachedCriteria criteria = DetachedCriteria.forClass(TResourceDuty.class);
//		criteria.add(Restrictions.like("dutyDate", dutyDate));
//		if (qbcDao.getCriteria(criteria).size()>0) {
//			return  (List)qbcDao.getCriteria(criteria).iterator().next();
//		}
//		return null;
//	}
	
//	public TResourceDuty findByDutyDate(String dutyDate){
//		// TODO Auto-generated method stub
//		return  trdd.findByDutyDate(dutyDate);
//	}

	public List findByExample(TResourceDuty instance) {
		// TODO Auto-generated method stub
		return resourcedutyDao.findByExample(instance);
	}
	
	public List findByProperty(String propertyName, Object value) {
		// TODO Auto-generated method stub
		return resourcedutyDao.findByProperty(propertyName, value);
	}
	
	public List findAll() {
		// TODO Auto-generated method stub
		return resourcedutyDao.findAll();
	}
	
	public List findByLikeProperty(String likeName, Object value){
		return resourcedutyDao.findByLikeProperty(likeName, value);
	}
	
	
}
